<#include "layout/template.ftl"/>
<@htmlHead title="抽奖活动列表">
<#-- page specific plugin styles -->
<#-- page specific plugin styles -->
<link rel="stylesheet" href="${resources}/assets/css/jquery-ui.css" />
<link rel="stylesheet" href="${resources}/assets/css/datepicker.css" />
<link rel="stylesheet" href="${resources}/assets/css/ui.jqgrid.css" />
<link rel="stylesheet" href="${resources}/plugins/jqgrid/4.6/jqgrid.extend.css" />
<link  rel="stylesheet" href="${resources}/assets/css/imgUploadCom.css" >

<style>
#grid-table td{
	text-align:center;
	
}
#fields-table thead th{
 	text-align: center;
}
</style>
</@htmlHead>
<@htmlBody 'lottery' 'lotteryManage'>
   <#-- start 头部显示当前位置 -->
	<#include "layout/breadcrumbs.ftl">
	<@breadcrumbs '抽奖活动管理' '抽奖活动列表'></@breadcrumbs>
   <#-- end 头部显示当前位置 -->
   <#-- start 主体部分 -->
   	<div class="page-content">
   		<#-- start 标题-->
		<div class="page-header">
			<h1>
				<i class="fa fa-trophy"></i>&nbsp;创建抽奖活动
			</h1>
		</div>
		<#--end标题  -->
		<#-- start 创建活动 -->
		<#-- start上传图片的路径-->
		<input id="uppath" type="hidden" value="${path}/upload/pic">
		<#-- end 上传图片的路径-->
		<div class="row">	
			<div class="col-md-6 col-md-offset-3">
				<form class="form-horizontal"  id="createLottery" action="${path}/manage/lottery/upcreate" method="post" >
					<#--start 温馨提示 -->
					<div class="form-group">
						<div class="col-md-12">
							<div class="clearfix">
								<p style="background-color:#BFE2FD;" class="form-control">温馨提示: 同一时间只能开启一个抽奖活动， 已启用的抽奖活动可以停用，停用后在列表中可以删除此活动。</p>
							</div>
						</div>
					</div>
					<#--end 温馨提示 -->
					<#-- start 活动基本信息 -->
					<div style="border: solid 1px #F6E9F2;background-color:#F6E9F2;" class="col-md-12">
						<div class="form-group" style="margin-top: 5px;">
	 						<label class="control-label col-md-2 no-padding-right" for="name">活动名称:</label>
							<div class="col-md-3">
								<div class="clearfix">
									<input class="form-control" disabled="disabled" value="${activity.name}"  type="text" name="name" id="name">
								</div>
							</div>
							<label class="control-label col-md-2 no-padding-right" for="name">抽奖类型:</label>
							<div class="col-md-3">
								<div class="clearfix">
									<select disabled="disabled" name="type" class="form-control">
										<option value="">请选择活动类型</option>
										<#list typeList as type>
											<option  <#if activity.type==type.value>selected="selected"</#if> value="${type.value}">${type.comment}</option>
										</#list>
									</select>
								</div>
							</div>
						</div>
						
						
						<div class="form-group" style="margin-top: 5px;">
	 						<label class="control-label col-md-2 no-padding-right" for="name">开始时间:</label>
							<div class="col-md-3">
								<div class="clearfix">
									<input class="form-control" value="${activity.startTime}" disabled="disabled" type="text" name="startTime" id="startTime">
								</div>
							</div>
							<label class="control-label col-md-2 no-padding-right" for="name">结束时间:</label>
							<div class="col-md-3">
								<div class="clearfix">
									<input class="form-control" value="${activity.endTime}" disabled="disabled" type="text" name="endTime" id="endTime">
								</div>
							</div>
						</div>
						<div class="form-group" style="margin-top: 5px;">
	 						<label class="control-label col-md-2 no-padding-right" for="name">活动状态:</label>
							<div class="col-md-3">
								<div class="clearfix">
								 	<select disabled="disabled" name="status" class="form-control">
								 		<option value="">请选择活动状态</option>
								 		<#list statusList as status>
								 			<#if status.value!=0>
								 				<option   <#if activity.status==status.value>selected="selected"</#if> value="${status.value}">${status.comment}</option>
								 			</#if>
								 		</#list>
								 	</select>
								</div>
							</div>
	 						<label class="control-label col-md-2 no-padding-right" for="name">消费满多少抽奖:</label>
							<div class="col-md-3">
								<div class="clearfix">
								 	<input class="form-control" value="${activity.score}" disabled="disabled"  type="text" name="score" id="score">
								</div>
							</div>
						</div>
						<!-- <div class="form-group" style="margin-top: 5px;">
	 						<label class="control-label col-md-2 no-padding-right" for="name">活动用途:</label>
							<div class="col-md-8">
								<div class="clearfix">
										<select disabled="disabled" name="scoretype" class="form-control">
								 		<option value="">请选择活动用途</option>
								 		<#list scoretypeList as status>
								 				<option <#if activity.scoretype==status.value>selected="selected" </#if> value="${status.value}">${status.comment}</option>
								 		</#list>
								 	</select>
								</div>
							</div>
						</div> -->
					<!-- 	<div class="form-group" style="margin-top: 5px;">
	 						<label class="control-label col-md-2 no-padding-right" for="name">活动图片:</label>
							<div class="col-md-8">
								<div class="clearfix">
									<img alt="" src="${activity.picurl}">
								</div>
							</div>
						</div> -->
						<div class="form-group" style="margin-top: 5px;">
	 						<label class="control-label col-md-2 no-padding-right" for="name">备注:</label>
							<div class="col-md-8">
								<div class="clearfix">
									<textarea disabled="disabled" style="resize: none;" name="remark" class="form-control" rows="4" cols=""></textarea>
								</div>
							</div>
						</div>
					</div>
					<#-- end 活动基本信息 -->
					<div class="form-group"></div>
					<#--start title -->
					<div id="info" class="form-group" style="margin-top: 20px;">
						<div class="col-md-12">
							<div class="clearfix">
								<p style="background-color:#BFE2FD;" class="form-control">奖品信息</p>
							</div>
						</div>
					</div>
					<#--start title -->
					<#--start 奖品信息 -->
					<#--<#list statusList as le>-->
						<div style="border: solid 1px #F6E9F2;background-color:#F6E9F2;" class="col-md-12">
								<input id="size" type="hidden" value="${activity.prizeList?size}">
						  	<table   id="fields-table" style="text-align: center;" class="table table-striped table-bordered table-hover">
				  				  <thead style="text-align: center;">
									  <th>奖品等级</th>
									  <th>奖品类型</th>
					 				  <th>奖品名称</th>
						 			  <th>奖品数量</th>
						 			  <th>话费金额</th>
						 			  <th>中奖概率</th>
								  </thead>
								  <#list activity.prizeList as prize>
					  			  <tr id="tr${prize_index}">
					  			  	<td style="text-align: center;line-height:normal; font-weight: bold;"><span id="level${prize_index}"></span>等奖</td>
					  	            <td>
					  	            	<#list prizetypeList  as type>
					  						<#if prize.type ==type.value>${type.comment}</#if>
					  					</#list>
					  				</td>
					  				<td>${prize.name}</td>
					  				<td>${prize.maxsum}</td>
					  				<td>${prize.score}</td>
					  				<td>${prize.probability}</td>
							 	 </tr>
							 	 </#list>
							</table>					
						</div>
				</div>
					<#--end 奖品信息-->
				
				</form>
			<!-- 提交开始 -->
                   <div class="form-group">
                   	<div class="col-md-12 center">
                    	<button id="form-submit" type="button" onclick="history.go(-1)"  class="btn btn-primary">
							<i class="fa fa-save align-top bigger-125"></i>返回上一页
						</button>
					</div>					
                 		</div>
				<!-- 提交结束  -->
			</div>
		</div>
		<#-- end 创建活动 -->
	</div>
   <#-- end 主体部分 -->		
</@htmlBody>
<@htmlBodyScript>

<script type="text/javascript">
$(function(){
	var length = $("#size").val();
	for (var i = 0; i <length; i++) {
		$("#level"+i).html(change(i));
	}
});
function change(num){
	var level = "";
	switch(num){
		case 0:
		level="一";
			break;
		case 1:
			level = "二";
			break;
		case 2:
			level = "三";
			break;
		case 3:
			level = "四";
			break;
		case 4:
			level = "五";
			break;
		case 5:
			level = "六";
			break;
		case 6:
			level = "七";
			break;
		case 7:
			level = "八";
			break;
		case 8:
			level = "九";
			break;
	}
	return level;
}


</script>


</@htmlBodyScript>